# Maintainer: David Runge <dvzrv@archlinux.org>

_name=rcssmin
pkgname=python-rcssmin
pkgver=1.1.2
pkgrel=1
pkgdesc="Fast CSS minifier for Python"
arch=(loong64 x86_64)
url="https://github.com/ndparker/rcssmin"
license=(Apache-2.0)
depends=(
  glibc
  python
)
makedepends=(
  python-build
  python-installer
  python-setuptools
  python-wheel
)
checkdepends=(python-pytest)
source=($_name-$pkgver.tar.gz::$url/archive/refs/tags/$pkgver.tar.gz)
sha512sums=('796f39b34867f9c135fd4d3fe1bd4282b1247974eb80c84cc3822fe7655399fb312a90c7a05b6a6e879169902591d5055fb25d7960ed6125e0f1a96fafebbf4e')
b2sums=('cd6d7a7615537bf1ff9ed3bd9c04de7bcde74aace7dc9f625f7afdb85ce3fa417ac3eedb8f990697ec87356759b17904caaf3c40fef3c448bcf85cc871beae1a')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  local _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")

  cd $_name-$pkgver
  python -m installer --destdir=test_dir dist/*.whl
  export PYTHONPATH="test_dir/$_site_packages:$PYTHONPATH"
  pytest -vv
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"
}
